package cn.wuxing.mediation.common.dingding;

import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

public class TokenFetcher {

    public String fetchToken() {
        String url = "https://i.njcit.cn/EIP/gettoken.htm?appid=cjrh&secret=SfxioNGraoIp";

        RestTemplate restTemplate = new RestTemplate();

        // 发送 GET 请求，接收响应
        ResponseEntity<TokenResponse> response = restTemplate.getForEntity(url, TokenResponse.class);

        // 返回 token
        return response.getBody().getToken();
    }
}
